angular.module("com.chag.app", ["ngRoute", "ngMessages", "ngAnimate"])

    .controller("IndexController", ["$log", function ($log) {

    }])

    .controller("DashboardController", ["$log", function ($log) {

    }])

    .controller("SignInController", ["$log", function ($log) {

    }])
    .config(["$routeProvider", "$locationProvider", "$httpProvider", function ($routeProvider, $locationProvider, $httpProvider) {
        //初始化GET请求方法
        if (!$httpProvider.defaults.headers.get) {
            $httpProvider.defaults.headers.get = {};
        }

        //IE下Ajax缓存禁用
        $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
        $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache';
        $httpProvider.defaults.headers.get['Pragma'] = 'no-cache';

        //定义前端路由
        $routeProvider.when('/', {
            templateUrl: 'dashboard.html',
            controller: 'DashboardController'
        }).when('/login', {
            templateUrl: 'login.html',
            controller: 'SignInController'
        }).when('/index/index', {
            templateUrl: 'index.html',
            controller: 'IndexController',
            reloadOnSearch: false
        }).otherwise({
            redirectTo: '/error/404',
            templateUrl: 'error/error404.html'
        });

        $locationProvider.html5Mode(false);
    }]);

